<!DOCTYPE html>
<script src="../../../resources/js-test.js"></script>
<style>
    body { color: black; }
    .match+div div+div { color: green; }
</style>
<div>
    <div id="top"></div>
    <div>
        <div></div>
        <div id="green"></div>
    </div>
    <div>
        <div></div>
        <div></div>
        <div></div>
        <div></div>
    </div>
</div>
<script>
if (window.testRunner)
    testRunner.dumpAsText();

description("Check that we don't do unnecessary style recalcs for sibling trees.");

if (window.internals)
    internals.updateStyleAndReturnAffectedElementCount();

document.getElementById("top").className = "match";

if (window.internals)
    shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "2");

shouldBe("getComputedStyle(document.getElementById('green'), null).color", "'rgb(0, 128, 0)'");

successfullyParsed = true;
</script>
